#include "limbo/ethernet/mac_address.h"

using namespace limbo::ethernet;

MacAddress::MacAddress(const unsigned char *data) {
  for (uint32_t i = 0; i < SZ; ++i) {
    bytes[i] = (uint8_t)data[i];
  }
}

MacAddress::MacAddress(const MacAddress &other) { *this = other; }

bool MacAddress::operator==(const MacAddress &other) const {
  for (uint32_t i = 0; i < SZ; ++i) {
    if (bytes[i] != other.bytes[i]) {
      return false;
    }
  }
  return true;
}

MacAddress &MacAddress::operator=(const MacAddress &other) {
  for (uint32_t i = 0; i < SZ; ++i) {
    bytes[i] = other.bytes[i];
  }
  return *this;
}

static const uint8_t broadcast_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
static const uint8_t unknown_mac[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

const MacAddress MacAddress::broadcast(broadcast_mac);
const MacAddress MacAddress::unknown(unknown_mac);
